package com.example.idachuappone.order.action;

import com.example.idachuappone.order.imageutil.Bimp;
import com.example.idachuappone.person.entity.Order;
import com.example.idachuappone.person.entity.OrderState;
import java.util.HashMap;

public class OrderAction {
    public int getPage(int deleteIndex) {
        if (Bimp.drr.size() == 1) {
            Bimp.drr.remove(deleteIndex);
        } else if (deleteIndex == Bimp.drr.size() - 1) {
            Bimp.drr.remove(deleteIndex);
            return Bimp.drr.size() - 1;
        } else if (deleteIndex < Bimp.drr.size() - 1) {
            Bimp.drr.remove(deleteIndex);
            return deleteIndex;
        }
        return -1;
    }

    public String getOrderTimeState(OrderState orderState, Order order) {
        HashMap<String, String> orderStatehHashMap = new HashMap();
        orderStatehHashMap.put("create", "\u8ba2\u5355\u63d0\u4ea4\u6210\u529f \u8bf7\u53ca\u65f6\u652f\u4ed8\u8ba2\u5355");
        orderStatehHashMap.put("cancel", "\u8ba2\u5355\u5df2\u53d6\u6d88 \u9000\u6b3e\u5904\u7406\u4e2d");
        orderStatehHashMap.put("finish", "\u5927\u53a8\u5df2\u5b8c\u6210\u670d\u52a1 \u8ba2\u5355\u5b8c\u6210");
        orderStatehHashMap.put("start", "\u5ba2\u670d\u5df2\u7ecf\u5904\u7406\u8ba2\u5355 \u8bf7\u8010\u5fc3\u7b49\u5f85\u5927\u53a8\u4e0a\u95e8\u670d\u52a1");
        orderStatehHashMap.put("weixin_pay", "\u8ba2\u5355\u5df2\u7ecf\u5b8c\u6210\u652f\u4ed8 \u8bf7\u8010\u5fc3\u7b49\u5f85\u5ba2\u670d\u5904\u7406");
        orderStatehHashMap.put("alipay_pay", "\u8ba2\u5355\u5df2\u7ecf\u5b8c\u6210\u652f\u4ed8 \u8bf7\u8010\u5fc3\u7b49\u5f85\u5ba2\u670d\u5904\u7406");
        orderStatehHashMap.put("balance_pay", "\u8ba2\u5355\u5df2\u7ecf\u5b8c\u6210\u652f\u4ed8 \u8bf7\u8010\u5fc3\u7b49\u5f85\u5ba2\u670d\u5904\u7406");
        orderStatehHashMap.put("working", "\u5927\u53a8\u4e0a\u95e8\u670d\u52a1\u4e2d \u8bf7\u8010\u5fc3\u7b49\u5f85\u5927\u53a8\u670d\u52a1");
        String substring = ((String) orderStatehHashMap.get(orderState.getOperation())).substring(0, ((String) orderStatehHashMap.get(orderState.getOperation())).indexOf(" "));
        String substring2 = ((String) orderStatehHashMap.get(orderState.getOperation())).substring(((String) orderStatehHashMap.get(orderState.getOperation())).indexOf(" ") + 1);
        if (orderState.getOperation().equals("create") && Integer.parseInt(order.getPay_type()) == 1) {
            substring = "\u8ba2\u5355\u63d0\u4ea4\u6210\u529f";
            substring2 = "\u8bf7\u8010\u5fc3\u7b49\u5f85\u5ba2\u670d\u5904\u7406";
        }
        if (orderState.getOperation().equals("cancel")) {
            if (Integer.parseInt(order.getPay_type()) == 0) {
                substring = "\u8ba2\u5355\u5df2\u53d6\u6d88";
                substring2 = "\u5df2\u5173\u95ed\u8ba2\u5355";
            }
            if (Integer.parseInt(order.getPay_type()) == 2 && Double.valueOf(order.getPay_status()).doubleValue() == 0.0d) {
                substring = "\u8ba2\u5355\u5df2\u53d6\u6d88";
                substring2 = "\u5df2\u5173\u95ed\u8ba2\u5355";
            }
            if (Integer.parseInt(order.getPay_type()) == 1) {
                substring = "\u8ba2\u5355\u5df2\u53d6\u6d88";
                substring2 = "\u5df2\u5173\u95ed\u8ba2\u5355";
            }
        }
        return new StringBuilder(String.valueOf(substring)).append(" ").append(substring2).toString();
    }
}
